/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BD;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ARMGARCES
 */
@Entity
@Table(name = "categoria_mp")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CategoriaMp.findAll", query = "SELECT c FROM CategoriaMp c"),
    @NamedQuery(name = "CategoriaMp.findByIdCategoriamp", query = "SELECT c FROM CategoriaMp c WHERE c.idCategoriamp = :idCategoriamp"),
    @NamedQuery(name = "CategoriaMp.findByNombre", query = "SELECT c FROM CategoriaMp c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "CategoriaMp.findByDescripcion", query = "SELECT c FROM CategoriaMp c WHERE c.descripcion = :descripcion")})
public class CategoriaMp implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idCategoria_mp")
    private Integer idCategoriamp;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @Column(name = "descripcion")
    private int descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkidCategoriamp")
    private List<Materiaprima> materiaprimaList;

    public CategoriaMp() {
    }

    public CategoriaMp(Integer idCategoriamp) {
        this.idCategoriamp = idCategoriamp;
    }

    public CategoriaMp(Integer idCategoriamp, String nombre, int descripcion) {
        this.idCategoriamp = idCategoriamp;
        this.nombre = nombre;
        this.descripcion = descripcion;
    }

    public Integer getIdCategoriamp() {
        return idCategoriamp;
    }

    public void setIdCategoriamp(Integer idCategoriamp) {
        this.idCategoriamp = idCategoriamp;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public int getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(int descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public List<Materiaprima> getMateriaprimaList() {
        return materiaprimaList;
    }

    public void setMateriaprimaList(List<Materiaprima> materiaprimaList) {
        this.materiaprimaList = materiaprimaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategoriamp != null ? idCategoriamp.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategoriaMp)) {
            return false;
        }
        CategoriaMp other = (CategoriaMp) object;
        if ((this.idCategoriamp == null && other.idCategoriamp != null) || (this.idCategoriamp != null && !this.idCategoriamp.equals(other.idCategoriamp))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "BD.CategoriaMp[ idCategoriamp=" + idCategoriamp + " ]";
    }
    
}
